package com.bdqn.hospital.mapper;

import com.bdqn.hospital.pojo.DrugBatch;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @version : 1.0
 * @Author :guogd
 * @createTime: 2023/03/01 14:30
 * @Description: com.bdqn.hospital.mapper
 */
@Mapper
public interface DrugBatchMapper {
    /**
     * 修改药品库存
     * @param prescriptionCount
     * @return
     */
    Integer updateResidueStock(Integer prescriptionCount,Integer prescriptionId);
    /**
     * 根据药品名称查询药品信息
     * @param name
     * @return
     */
    DrugBatch getDrug(@Param("name") String name);

    /**
     * 查询该药品数量
     * @param id
     * @return
     */
    @Select("select count(*) from drug_batch\n" +
            "where id=#{id} and residue_stock >#{count}")
    Integer isConut(@Param("id") Integer id,@Param("count") Integer count);
}
